We develop a full example of a pre-processor for an application.


1. Generation of several files at the same time

A specific processor can be (quite) easily built into KM2.

1.1. The problem

We want to generate a table in the .csv format, and at the same time explain exactly in some document the reasons.

1.1.1. The data

The data is in this table
Name Adress Map Note
Peter Broadway, NY, USA
Jean rue de Rivoli, Paris, France
Jean worked 10 years in Quebec
Maria Madrid, Spain
Maria lived there, but was born in Switzerland

1.1.2. The files we want

We will use the following primitives
  • *collect
  • *flush
  • *setf
  • EXTRACT TABLE
we want several files :

1.1.3. Writing the generation of documents

The csv file We create the file as follows :



The html file is defined as :


The steps are simple :

Now, each modification of a name, or adress or adding lines to the table, will be reflected in the output files.

It is not recommended to use large tables in xmind (number of lines > 50)
In this case, try to proceed with a specific file and loops with dictionnaries.
For example, we have a file in the json format, with contains names and adresses, and a directory with images which are labelled accordingly as "Name_map.jpg" As previously, we want to generate an html file with the names , adresses and images of maps.
This can be done as follows :

2. Generation of complex code with macros

make sure that we can generate a file with one line

2.1. First, make sure that we can generate a file with one line

2.2. Creating the basic tools and macros






...